<template>
    <div class="wrapper" ref="content">
        <div class="content">
            <slot></slot>
        </div>
    </div>
</template>

<script>
import Bscoll from 'better-scroll'
export default {
    props:['prototype'],
    data() {
        return {
            bscoll:null,
            showbacktop:false
        }
    },
    mounted() {
        this.bscoll = new Bscoll(this.$refs.content,{
            observeDOM:true,
            observeImage:true,
            click:true,
            probeType:this.prototype || 0,
            pullUpLoad:{
                debounceTime: 100 
            }
            
        })
        // 监听滚动
        this.bscoll.on('scroll',postion=>{
           this.showbacktop =  postion.y>-1000?false:true
           this.$emit('isshowbacktop',postion)
        })
        // 监听上拉加载更多
        this.bscoll.on('pullingUp',()=>{
            this.$emit('pullingUp')
            this.bscoll.finishPullUp()
        })
    },
}
</script>

<style scoped>


</style>